package com.jsb.laundry.common.design_service.pay.enums;

/**
 * 支付方式枚举
 *
 * @author zmy
 * @create 2023-07-26 22:24
 */
public enum PayModeEnum {
    JSB_USER_WECHAT_MINI_PAY("1", "微信支付-小程序(用户端)") {
        @Override
        public void handle() {

        }
    },
    JSB_WECHAT_APP_PAY("2", "微信支付-APP") {
        @Override
        public void handle() {

        }
    },
    JSB_ALI_PAY("3", "支付宝支付") {
        @Override
        public void handle() {

        }
    },
    JSB_UNION_PAY("4", "银联支付") {
        @Override
        public void handle() {

        }
    },
    ;

    public abstract void handle();

    private String code;

    private String msg;

    PayModeEnum(String code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    /**
     * 根据code找枚举名
     *
     * @param code
     * @return
     */
    public static String getNameById(String code) {
        for (PayModeEnum value : values()) {
            if (value.getCode().equals(code)) {
                return value.name();
            }
        }
        return null;
    }

    /**
     * 根据枚举名查找是否存在该枚举对象
     *
     * @param enumName
     * @return (true 存在, false 不存在)
     */
    public static Boolean supportEnum(String enumName) {
        for (PayModeEnum value : values()) {
            if (value.name().equals(enumName)) {
                return true;
            }
        }
        return false;
    }

    /**
     * 根据枚举name找枚举对象
     *
     * @param name
     * @return
     */
    public static PayModeEnum getEnumObjByName(String name) {
        return PayModeEnum.valueOf(name);
    }

    public static void main(String[] args) {
//        Integer a = 10;
//        Integer b = 10;
//        System.out.println(a == b);

        Integer c = 200;
        Integer d = 200;
        System.out.println(c == d);
    }

}
